All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.sun.java.swing.JButton

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----com.sun.java.swing.JComponent
                           |
                           +----com.sun.java.swing.AbstractButton
                                   |
                                   +----com.sun.java.swing.JButton

public class JButton
extends AbstractButton
implements Accessible
An implementation of a "push" button.

To create a set of mutually exclusive buttons, create a ButtonGroup object and use its add method to include the JButton objects in the group.

See How to Use Buttons in The Java Tutorial for further documentation.

For the keyboard keys used by this component in the standard Look and Feel (L&F) renditions, see the JButton key assignments.

Warning: serialized objects of this class will not be compatible with future swing releases. The current serialization support is appropriate for short term storage or RMI between Swing1.0 applications. It will not be possible to load serialized Swing1.0 objects with future releases of Swing. The JDK1.2 release of Swing will be the compatibility baseline for the serialized form of Swing objects.

See Also:
ButtonGroup

Constructor Index

 o JButton()
Creates a button with no set text or icon.
 o JButton(Icon)
Creates a button with an icon.
 o JButton(String)
Creates a button with text.
 o JButton(String, Icon)
Creates a button with initial text and an icon.

Method Index

 o getAccessibleContext()
Get the AccessibleContext associated with this JComponent
 o getUIClassID()
Returns a string that specifies the name of the L&F class that renders this component.
 o isDefaultButton()
Returns whether or not this button is the default button on the RootPane.
 o updateUI()
Notification from the UIFactory that the L&F has changed.

Constructors

 o JButton
 public JButton()
Creates a button with no set text or icon.

 o JButton
 public JButton(Icon icon)
Creates a button with an icon.

Parameters:
icon - the Icon image to display on the button
 o JButton
 public JButton(String text)
Creates a button with text.

Parameters:
text - the text of the button
 o JButton
 public JButton(String text,
                Icon icon)
Creates a button with initial text and an icon.

Parameters:
text - the text of the button.
icon - the Icon image to display on the button

Methods

 o updateUI
 public void updateUI()
Notification from the UIFactory that the L&F has changed.

Overrides:
updateUI in class AbstractButton
See Also:
updateUI
 o getUIClassID
 public String getUIClassID()
Returns a string that specifies the name of the L&F class that renders this component.

Returns:
"ButtonUI"
Overrides:
getUIClassID in class JComponent
See Also:
getUIClassID, getUI
 o isDefaultButton
 public boolean isDefaultButton()
Returns whether or not this button is the default button on the RootPane.

Returns:
"boolean"
See Also:
setDefaultButton
 o getAccessibleContext
 public AccessibleContext getAccessibleContext()
Get the AccessibleContext associated with this JComponent

Returns:
the AccessibleContext of this JComponent
Overrides:
getAccessibleContext in class JComponent

All Packages  Class Hierarchy  This Package  Previous  Next  Index